import { ButtonProps } from 'antd'

export interface IUser {
  _id: string
  email: string
  name: string
  accessLevel: 'usual' | 'admin'
}
export interface ILogin {
  email: string
  password: string
}
export interface IUserUpdate {
  email: string
  name: string
}
export interface IRegister {
  email: string
  name: string
  password: string
}
export interface IToken {
  token: string
}
export interface IMainApiAuth {
  readonly baseUrl: string
  readonly headers: Object
  checkToken(token: string): Promise<any>
  signup(registerData: IRegister): Promise<any>
  signin(loginData: ILogin): Promise<any>
}
export interface IMainApi {
  getUserInfo(): Promise<any>
  setUserInfo(updateUserData: IUserUpdate): Promise<any>
}
export interface IPerson {
  _id: string
  firstName: string
  lastName: string
  middleName?: string
  birthDay: Date | null
  comment: string
  config: Object
  isActive: boolean
  email?:string
  phone?:string
  telegram?: string
  sex?: 'male' | 'female'
  photo?: string
}

export interface IEmployee extends IPerson {
  grade?: 'junior' | 'middle' | 'senior'
}

export interface IProjectManager extends IPerson {

}

export interface IProject {
  _id: string
  title: string
  code: string
  manager?: IProjectManager
  from: Date | null
  to: Date | null
  comment?: string
  config?: Object
  boardLink?: string
  isActive: boolean
  responsibleEmployee?: IEmployee
}
export interface IProjectToEmployeeLink {
  _id: string
  employee: IEmployee
  project: IProject
  periods: IPeriod[]
  comment?: string
}
export interface IMapProjectToManager {
  manager: IProjectManager
  project: IProject
}

export interface IPeriod {
  id: string
  startTime: Date
  endTime: Date
}

export interface IModalWindow {
  title: string
  isLoading?: boolean
  isError?: boolean
  isShow: boolean
  errorMessage?: string
  buttonSet: ButtonProps[]
  content: React.ReactElement | string
  footer?: React.ReactElement | React.ReactElement[] | ((param: any) => React.ReactElement) | string
  onOk?: () => void
  onClose?: () => void
}

export interface IAntSelectOption {
  value: string
  label: string
}
